import Home from '@/pages/Home'
import Article from '@/pages/Article'
import Publish from '@/pages/Publish'
// import Login from '@/pages/Login'
// import NotFound from '@/pages/NotFound'
import AuthRoute from '@/components/AuthRoute'
// import Layout from '@/pages/Layout'
import { lazy } from 'react'

// 懒加载
const Layout = lazy(() => import('@/pages/Layout'))
const Login = lazy(() => import('@/pages/Login'))
const NotFound = lazy(() => import('@/pages/NotFound'))

const routes = [
  {
    path: '/',
    element: <AuthRoute element={<Layout />} />,
    children: [
      {
        path: '/',
        element: <Home />
      },
      {
        path: 'article',
        element: <Article />
      },
      {
        path: 'publish',
        element: <Publish />
      },
      {
        path: 'publish/:id',
        element: <Publish />
      }
    ]
  },
  {
    path: '/login',
    element: <Login />
  },
  {
    path: '*',
    element: <NotFound />
  },
]

export default routes

